require 'rubygems'
require 'test/unit'
require 'mocha'
require 'agent'
require 'server'
require 'socket'
require 'database'
require 'remote_agent'
require 'fileutils'
include FileUtils

class TestEndToEnd < Test::Unit::TestCase

  def setup
    Database.test_connect
    SharedFile.stubs(:fetch_content).returns(mock())
    @server = Server.instance()
    @agent = Agent.instance()
    @server.start
    @agent.start
  end

  def teardown
    @server.stop
    @agent.stop
  end

  def test_agent_publishes_to_server
    @agent.interface.publish_to_server
    assert_equal("/path/to/config",RemoteFile.find_by_path("/path/to/config").path)
  end

end
